package org.gary.base.service.impl;

import java.util.List;
import java.util.Map;

import org.gary.base.model.Link;
import org.gary.base.service.LinkService;
import org.gary.core.factories.impl.BasicServiceFactoryImpl;
import org.gary.core.util.ResultMessage;
import org.springframework.stereotype.Component;
/**
 * 友情链接Service实现类
 * @author Gary
 *
 */
@Component("linkService")
public class LinkServiceImpl extends BasicServiceFactoryImpl<Link> implements
		LinkService {

	@Override
	public String save(Link entity) {
		// 在友情链接保存之前记录一条日志
		getLoggerService().makeLog(entity.getClass().getName(),
				"开始保存一个友情链接" + entity);
		getBasicDaoFactory().save(entity);
		// 在友情链接保存之后记录一条日志
		getLoggerService().makeLog(entity.getClass().getName(),
				"保存一个友情链接成功" + entity);
		return ResultMessage.link.ADD_SUCCESS;
	}
	
	@Override
	public List<Link> getLink(int page, int maxCount, Object[] orderBy) {
		// TODO Auto-generated method stub
		return list(Link.class, page, maxCount, orderBy);
	}

	@Override
	public List<Link> getLink(Map<String, Object> where, int page,
			int maxCount, Object[] orderBy) {
		// TODO Auto-generated method stub
		return list(Link.class, page, maxCount, where, orderBy);
	}
}
